package com.pdsu.graduation_design.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.pdsu.graduation_design.R;

public class MyToolsGridViewAdapter extends BaseAdapter {

    public MyToolsGridViewAdapter(Context context) {
        this.context = context;
    }

    private Context context;
    private ImageView imageView;
    private TextView title;

    private int[] images={R.drawable.my_like,R.drawable.my_address,R.drawable.my_youhuijuan,R.drawable.my_service,R.drawable.up_commodity_icon};
    private String[] titles={"我的收藏","我的地址","优惠卷","客服","上架商品"};

    @Override
    public int getCount() {
        return images.length;
    }

    @Override
    public Object getItem(int position) {
        return images[position];
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view=View.inflate(context, R.layout.my_gridview_item,null);

        imageView=view.findViewById(R.id.my_gridview_image);
        title=view.findViewById(R.id.my_gridview_title);

        imageView.setImageResource(images[position]);
        title.setText(titles[position]);


        return view;
    }
}
